﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BT_DoHoa_Nhom13.ShapeLib.ActivityShapes
{
    public class ActivityEndShape : MyDiagramShape
    {
        public const float PERCENT = 0.25f;
        public ActivityEndShape()
        {
            // TODO: Complete member initialization
            name = "End";
            lstShapes = new List<MyShape>();
            lstShapes.Add(new MyEllipse());
            lstShapes.Add(new MyEllipse());

            lstShapes[lstShapes.Count - 1].SetFill(true);
        }

        public override MyShape Clone()
        {
            return new ActivityEndShape();
        }

        public override MyShape CloneByDiagramFactory(DiagramFactorys.MyDiagramFactory factory)
        {
            MyShape newShape = factory.GetEndShape();
            newShape.Copy(this);
            return newShape;
        }

        public override void ResetChildPoint()
        {
            int top, left, width, height;
            this.SetConfig(out top, out left, out width, out height);
            int distance =(int)(PERCENT * width);

            lstShapes[0].SetStartPoint(startX, startY);
            lstShapes[0].SetEndPoint(endX, endY);

            lstShapes[1].SetStartPoint(left + distance, top + distance);
            lstShapes[1].SetEndPoint(left + width - distance, top + height - distance);
        }
    }
}
